package com.sugon.stream;

import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.stream.Stream;

/**
 * 流的创建
 */
public class TestStream_create {

	public static void main(String[] args) throws Exception{
		Stream<String> stream1 = Stream.of("ABC","DEF","XYZ");
		Stream<String> stream2 = Arrays.stream(new String[]{"ABC","DEF","XYZ"});

		//读取文件放入流中
		Stream<String> stream3 = Files.lines(Paths.get("file.txt"), Charset.defaultCharset());
		stream3.forEach(System.out::println);
	}

}
